//
//  peopleGroup.m
//  Light
//
//  Created by 骁唐 on 15/9/9.
//  Copyright (c) 2015年 骁唐. All rights reserved.
//

#import "peopleGroup.h"
#import "People.h"

@implementation peopleGroup

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init]) {
        
        // 赋值属性
        // [self setValuesForKeysWithDictionary:dict];
        self.title = dict[@"title"];
        NSArray *dictArray =  dict[@"peoples"];
        // 将字典转换为模型
        NSMutableArray *models = [NSMutableArray arrayWithCapacity:dictArray.count];
        for (NSDictionary *dict in dictArray) {
            People *people = [People peopleWithDict:dict];
            [models addObject:people];
        }
        // 赋值存储模型的数组给属性
        self.peoples = models;
    }
    return self;
}
+ (instancetype)peopleGroupWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}


@end
